<div id="buscabarra">
<table width="100%" border="0" cellpadding="10" cellspacing="0">
<form action="buscar.php" method="get">

<tr>

<td width="38%" valign="middle"><input disabled="true" name="customerNumber" size="16" type="hidden" />
<input name="busca" type="text" class="buscainput" id="mybox" onBlur="if(this.value==''){this.value='Digitar aqui a pesquisa';}; this.style.color='#CCC'; this.style.fontStyle='italic'" onClick="if(this.value=='Digitar aqui a pesquisa'){this.value=''}; this.style.color='#333'; this.style.fontStyle='normal'; this.style.boder='solid 2px #ccc';" value="<?php if(!$_GET["busca"]){ echo "Digitar aqui a pesquisa"; }else{ echo $_GET["busca"];} ?>" size="40" autocomplete="on" /></td>


<td width="14%" valign="middle"><select name="estado" class="gh-sb">
  <option value="2" <? if($_GET["estado"]==2 OR !isset($_GET["estado"])){ echo "selected";} ?>>Usado &amp; Novo</option>
  <option value="0" <? if(isset($_GET["estado"]) and $_GET["estado"]==0){ echo "selected";} ?> >Usado</option>
  <option value="1" <? if($_GET["estado"]==1){ echo "selected";} ?>>Novo</option>
</select></td>





<td width="17%" valign="middle"><select name="cat" class="gh-sb">
<option value="todas" selected>Todas as categorias</option>
<?php 
$dadoscatesq	= $_cat->lista(false,false,"ORDER BY titulo");
foreach($dadoscatesq as $cat){
?>
<option value="<?php echo $cat["id"]; ?>" <?php if($_GET["cat"] == $cat["id"]){ echo "selected";} ?>><?php echo $cat["titulo"]; ?></option>
<?php } ?>
</select></td>


<td width="31%" valign="middle"><input type="submit" class="gh-bt" value="Buscar!" /></td>


</tr>


</form>
</table>
</div>

<?php //die(); ?>

<script> 
    new Autocomplete("busca", function() { 
        this.setValue = function(id) {
            document.getElementsByName("customerNumber")[0].value = id;
        }
        if (this.isModified) this.setValue("");
        if (this.value.length < 1) return ;
        return "lib/busca-principal.php?q=" + this.value;
    }); 
</script>

